home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM Gold
/
Light ROM Gold.iso
/
arexx
/
loadscen.rex
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-11-03
|
4KB
|
204 lines
/********************************************************************/
/* */
/* Load from Scene V1.0 */
/* */
/* Loads Objects from Lightwave Scene File */
/* */
/* ⌐ 1994 By AndrΘ Hotz -=< Imaginative Systems >=- */
/* */
/********************************************************************/
call AddLib "LWModelerARexx.port", 0
ver = 'V1.0'
name = 'Load from Scene '||ver
signal on error
signal on syntax
layer = CurLayer()
scenename = GetFileName('Select Scene File:')
if scenename ~= '(none)' then do
call ReadScene()
call Req_Begin(name)
tid = Req_AddControl('Load Objects','CH','All' 'Selective')
call Req_SetVal(tid,1)
if (~Req_Post()) then do
call Req_End()
exit
end
typ = Req_GetVal(tid)
call Req_End()
do s=1 to n
obj.s = 1
end
if typ = 2 then do
i=1
a=1
b=1
do until i=n+1
call Req_Begin(name||' -- Select Objects to Load')
do until ((i//15=0) | (i=n+1))
id.i = Req_AddControl(objectp.i,'B')
i=i+1
end
do until ((a//15=0) | (a=n+1))
call Req_SetVal(id.a,0)
a=a+1
end
if (~Req_Post()) then do
call Req_End()
exit
end
do until ((b//15=0) | (b=n+1))
obj.b=0
if Req_GetVal(id.b)=1 then do
obj.b = 1
end
b=b+1
end
call Req_End()
end
end
call CUT()
call Sel_Mode(USER)
do i=1 to n
if obj.i = 1 then do
call SetLayer(layer+1)
call Cut()
call Load(objectp.i)
parse var objectdata.i x y z rx ry rz sx sy sz
movev = x||' '||y||' '||z
scalev = sx||' '||sy||' '||sz
call Scale(scalev,0)
call Rotate(-rx,'Y',0)
call Rotate(-ry,'X',0)
call Rotate(-rz,'Z',0)
call Move(movev)
a=i
ppos=i
if parentobject.i ~= -1 then call ParentPos(i)
call Sel_Polygon(CLEAR)
call Copy()
call SetLayer(layer)
call Paste()
end
end
call Close(scene)
call Notify(1,'!Thanks for using Load from Scene '||ver,'','@⌐ 1994 By AndrΘ Hotz','@of','-=> Imaginative Systems <=-','-=> Productions <=-','')
end
call RemLib "LWModelerARexx.port"
exit
ReadScene:
if Open(scene,scenename,'READ') then do
n=0
vergleich=0
do until vergleich=1
buffer = Readln(scene)
if word(buffer,1)='LoadObject' then do
n=n+1
parse var buffer 12 objectp.n
call GetObjInfo2()
end
vergleich=0
if word(buffer,1)='AmbientColor' then vergleich=1
end
call Close(scene)
end
return
GetObjInfo2:
do until word(buffer,1)='ObjectMotion'
buffer=Readln(scene)
end
buffer=Readln(scene)
buffer=Readln(scene)
objectdata.n=Readln(scene)
do until word(buffer,1)='EndBehavior'
buffer=Readln(scene)
end
buffer=Readln(scene)
if word(buffer,1)='ParentObject' then parentobject.n=word(buffer,2)
else parentobject.n= -1
return
ParentPos: procedure expose a parentobject. objectdata. objectp.
arg ppos
a = parentobject.ppos
if parentobject.ppos ~=-1 then do
nr = parentobject.ppos
parse var objectdata.nr x y z rx ry rz sx sy sz
movev = x||' '||y||' '||z
scalev = sx||' '||sy||' '||sz
call Scale(scalev,0)
call Rotate(-rx,'Y',0)
call Rotate(-ry,'X',0)
call Rotate(-rz,'Z',0)
call Move(movev)
call ParentPos(parentobject.ppos)
end
return
syntax:
error:
call end_all
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
exit